<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:t="http://myfaces.apache.org/tomahawk"
	xmlns:v="http://corejsf.com/validator">

<f:view>
	<f:loadBundle var="text" basename="#{campusForm.bundleName}" />
	<head>
	<title>#{text['campusDetail.title']}</title>
	<meta name="heading" content="#{text['campusDetail.heading']}" />
	<style type="text/css">
.jscalendar-DB-div-style {
	position: absolute;
	margin-top: -120px;
	margin-left: -508px;
}
</style>
	</head>
	<body id="campusForm">

	<h:form id="campusForm" onsubmit="return validateCampusForm(this)">
		<h:inputHidden value="#{campusForm.campus.campusId}" id="campusId" />
		<h:panelGrid columns="3">
			<h:outputLabel styleClass="desc" for="description"
				value="#{text['campus.description']}" />
			<t:message for="description" styleClass="fieldError" />
			<h:inputText styleClass="text medium" id="description"
				value="#{campusForm.campus.description}" required="false"
				maxlength="255">
			</h:inputText>
			<h:outputLabel styleClass="desc" for="name"
				value="#{text['campus.name']}" />
			<t:message for="name" styleClass="fieldError" />
			<h:inputText styleClass="text medium" id="name"
				value="#{campusForm.campus.name}" required="false" maxlength="255">
			</h:inputText>

			<h:panelGroup>
				<t:htmlTag value="label" styleClass="desc">
					<h:outputText value="#{text['campus.address.address']}" />
				</t:htmlTag>
				<t:htmlTag value="div" styleClass="group">
					<t:htmlTag value="div">
						<h:inputText value="#{campusForm.campus.address.address}" id="address"
							styleClass="text large" />
						<t:message for="address" styleClass="fieldError" />
						<t:htmlTag value="p">
							<h:outputLabel for="address"
								value="#{text['campus.address.address']}" />
						</t:htmlTag>
					</t:htmlTag>
					<t:htmlTag value="div" styleClass="left">
						<h:inputText value="#{campusForm.campus.address.city}" id="city"
							required="true" styleClass="text medium">
							<v:commonsValidator type="required"
								arg="#{text['campus.address.city']}" />
						</h:inputText>
						<t:message for="city" styleClass="fieldError" />
						<t:htmlTag value="p">
							<h:outputLabel for="city" value="#{text['campus.address.city']}" />
						</t:htmlTag>
					</t:htmlTag>
					<t:htmlTag value="div">
						<h:inputText value="#{campusForm.campus.address.province}"
							id="province" required="true" styleClass="text state">
							<v:commonsValidator type="required"
								arg="#{text['campus.address.province']}" />
						</h:inputText>
						<t:message for="province" styleClass="fieldError" />
						<t:htmlTag value="p">
							<h:outputLabel for="province"
								value="#{text['campus.address.province']}" />
						</t:htmlTag>
					</t:htmlTag>
					<t:htmlTag value="div" styleClass="left">
						<h:inputText value="#{campusForm.campus.address.postalCode}"
							id="postalCode" required="true" styleClass="text medium">
							<v:commonsValidator type="required"
								arg="#{text['campus.address.postalCode']}" />
							<t:validateRegExpr pattern="^\d{5}\d*$" />
						</h:inputText>
						<t:message for="postalCode" styleClass="fieldError" />
						<t:htmlTag value="p">
							<h:outputLabel for="postalCode"
								value="#{text['campus.address.postalCode']}" />
						</t:htmlTag>
					</t:htmlTag>
					<t:htmlTag value="div">
						<h:selectOneMenu value="#{campusForm.country}" id="country"
							required="true" styleClass="select">
							<f:selectItems value="#{campusForm.countries}" />
							<v:commonsValidator type="required"
								arg="#{text['campus.address.country']}" />
						</h:selectOneMenu>
						<t:message for="country" styleClass="fieldError" />
						<t:htmlTag value="p">
							<h:outputLabel for="country"
								value="#{text['campus.address.country']}" />
						</t:htmlTag>
					</t:htmlTag>
				</t:htmlTag>
			</h:panelGroup>

			<h:panelGroup styleClass="buttonBar bottom">
				<h:commandButton value="#{text['button.save']}"
					action="#{campusForm.save}" id="save" styleClass="button" />

				<c:if test="${not empty campusForm.campus.campusId}">
					<h:commandButton value="#{text['button.delete']}"
						action="#{campusForm.delete}" id="delete" styleClass="button"
						onclick="bCancel=true; return confirmDelete('Campus')" />
				</c:if>

				<h:commandButton value="#{text['button.cancel']}"
					action="campusList" immediate="true" id="cancel"
					styleClass="button" onclick="bCancel=true" />
			</h:panelGroup>
			<h:outputText />
			<h:outputText />
		</h:panelGrid>
	</h:form>

	<v:validatorScript functionName="validateCampusForm" />

	<script type="text/javascript">
    //Form.focusFirstElement($('campusForm'));
    highlightFormElements();
</script>

	</body>
</f:view>
</html>
